<!DOCTYPE HTML>
<html lang="en">
<head>
<title>List of Keys (Keyboard, Mouse and Joystick) | AutoHotkey</title>
<meta name="description" content="This page lists all mouse buttons, keyboard keys and joystick buttons which can be used for hotkeys and key-specific commands/functions." />
<meta name="keywords" content="keyboard,keys,key,mouse,buttons,button,joystick,create,hotkeys,hotkey,macros">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="static/theme.css" rel="stylesheet" type="text/css" />
<script src="static/content.js" type="text/javascript"></script>
</head>
<body>
<h1>List of Keys <span class="headnote">(Keyboard, Mouse and Joystick)</span></h1>
<h2 id="toc">Table of Contents</h2>
<ul>
  <li><a href="#mouse">Mouse</a>
    <ul>
      <li><a href="#mouse-general">General Buttons</a></li>
      <li><a href="#mouse-advanced">Advanced Buttons</a></li>
      <li><a href="#mouse-wheel">Wheel</a></li>
    </ul>
  </li>
  <li><a href="#keyboard">Keyboard</a>
    <ul>
      <li><a href="#general">General Keys</a></li>
      <li><a href="#cursor">Cursor Control Keys</a></li>
      <li><a href="#numpad">Numpad Keys</a></li>
      <li><a href="#function">Function Keys</a></li>
      <li><a href="#modifier">Modifier Keys</a></li>
      <li><a href="#multimedia">Multimedia Keys</a></li>
      <li><a href="#other">Other Keys</a></li>
    </ul>
  </li>
  <li><a href="#Joystick">Joystick</a></li>
  <li><a href="#remote">Hand-held Remote Controls</a></li>
  <li><a href="#SpecialKeys">Special Keys</a></li>
  <li><a href="#IME">CapsLock and IME</a></li>
</ul>

<h2 id="mouse">Mouse</h2>
<h3 id="mouse-general">General Buttons</h3>
<table class="info">
  <tr>
    <td style="width:12em">LButton</td>
    <td>The left mouse button when used with Send, but the primary mouse button when used with hotkeys. In other words, if the user has swapped the buttons via system settings, <code>LButton::</code> is physically activated by clicking the <strong>right</strong> mouse button, but <code>Send {LButton}</code> performs the same as physically clicking the <strong>left</strong> button. To always perform a logical left click, use <code>Click Left</code> or <code>Send {Click Left}</code>.</td>
  </tr>
  <tr>
    <td>RButton</td>
    <td>The right mouse button when used with Send, but the secondary mouse button when used with hotkeys. In other words, if the user has swapped the buttons via system settings, <code>RButton::</code> is physically activated by clicking the <strong>left</strong> mouse button, but <code>Send {RButton}</code> performs the same as physically clicking the <strong>right</strong> button. To always perform a logical right click, use <code>Click Right</code> or <code>Send {Click Right}</code>.</td>
  </tr>
  <tr>
    <td>MButton</td>
    <td>Middle or wheel mouse button</td>
  </tr>
</table>
<h3 id="mouse-advanced">Advanced Buttons</h3>
<table class="info">
  <tr>
    <td style="width:12em">XButton1</td>
    <td>4th mouse button. Typically performs the same function as Browser_Back.</td>
  </tr>
  <tr>
    <td>XButton2</td>
    <td>5th mouse button. Typically performs the same function as Browser_Forward.</td>
  </tr>
</table>
<h3 id="mouse-wheel">Wheel</h3>
<table class="info">
  <tr>
    <td style="width:12em">WheelDown</td>
    <td>Turn the wheel downward (toward you).</td>
  </tr>
  <tr>
    <td>WheelUp</td>
    <td>Turn the wheel upward (away from you).</td>
  </tr>
  <tr>
    <td>WheelLeft<br>WheelRight</td>
    <td><p><span class="ver">[v1.0.48+]:</span> Scroll to the left or right.</p>
    <p>Requires Windows Vista or later. These can be <a href="Hotkeys.htm#HWheel">used as hotkeys</a> with some (but not all) mice which have a second wheel or support tilting the wheel to either side. In some cases, software bundled with the mouse must instead be used to control this feature. Regardless of the particular mouse, <a href="commands/Send.htm">Send</a> and <a href="commands/Click.htm">Click</a> can be used to scroll horizontally in programs which support it.</p></td>
  </tr>
</table>
<h2 id="keyboard">Keyboard</h2>
<p class="note"><strong>Note</strong>: The names of the letter and number keys are the same as that single letter or digit. For example: b is the <kbd>B</kbd> key and 5 is the <kbd>5</kbd> key.</p>
<p>Although any single character can be used as a key name, its meaning (scan code or virtual keycode) depends on the current keyboard layout. Additionally, some special characters may need to be escaped or enclosed in braces, depending on the context. <span class="ver">[v1.1.27+]:</span> The letters a-z or A-Z can be used to refer to the corresponding virtual keycodes (usually vk41-vk5A) even if they are not included in the current keyboard layout.</p>
<h3 id="general">General Keys</h3>
<table class="info">
  <tr>
    <td style="width:12em">CapsLock</td>
    <td><kbd>CapsLock</kbd> (caps lock key)
      <p class="warning"><strong>Note:</strong> Windows IME may interfere with the detection and functionality of CapsLock; see <a href="#IME">CapsLock and IME</a> for details.</p>
    </td>
  </tr>
  <tr>
    <td>Space</td>
    <td><kbd>Space</kbd> (space bar)</td>
  </tr>
  <tr>
    <td>Tab</td>
    <td><kbd>Tab</kbd> (tabulator key)</td>
  </tr>
  <tr>
    <td>Enter</td>
    <td><kbd>Enter</kbd></td>
  </tr>
  <tr>
    <td>Return</td>
    <td><strong>Deprecated:</strong> Use the synonym <code>Enter</code> instead to reduce ambiguity.</td>
  </tr>
  <tr>
    <td>Escape (or Esc)</td>
    <td><kbd>Esc</kbd></td>
  </tr>
  <tr>
    <td>Backspace (or BS)</td>
    <td><kbd>Backspace</kbd></td>
  </tr>
</table>
<h3 id="cursor">Cursor Control Keys</h3>
<table class="info">
  <tr>
    <td style="width:12em">ScrollLock</td>
    <td><kbd>ScrollLock</kbd> (scroll lock key). While the <kbd>Ctrl</kbd> key is held down, the <kbd>ScrollLock</kbd> key produces the key code of <code>CtrlBreak</code>, but can be differentiated from <kbd>Pause</kbd> by scan code.</td>
  </tr>
  <tr>
    <td>Delete (or Del)</td>
    <td><kbd>Delete</kbd></td>
  </tr>
  <tr>
    <td>Insert (or Ins)</td>
    <td><kbd>Insert</kbd></td>
  </tr>
  <tr>
    <td>Home</td>
    <td><kbd>Home</kbd></td>
  </tr>
  <tr>
    <td>End</td>
    <td><kbd>End</kbd></td>
  </tr>
  <tr>
    <td>PgUp</td>
    <td><kbd>PageUp</kbd> (page up key)</td>
  </tr>
  <tr>
    <td>PgDn</td>
    <td><kbd>PageDown</kbd> (page down key)</td>
  </tr>
  <tr>
    <td>Up</td>
    <td><kbd>&uarr;</kbd> (up arrow key)</td>
  </tr>
  <tr>
    <td>Down</td>
    <td><kbd>&darr;</kbd> (down arrow key)</td>
  </tr>
  <tr>
    <td>Left</td>
    <td><kbd>&larr;</kbd> (left arrow key)</td>
  </tr>
  <tr>
    <td>Right</td>
    <td><kbd>&rarr;</kbd> (right arrow key)</td>
  </tr>
</table>
<h3 id="numpad">Numpad Keys</h3>
<p>Due to system behavior, the following keys seperated by a slash are identified differently depending on whether <kbd>NumLock</kbd> is ON or OFF. If <kbd>NumLock</kbd> is OFF but <kbd>Shift</kbd> is pressed, the system temporarily releases <kbd>Shift</kbd> and acts as though <kbd>NumLock</kbd> is ON.</p>
<table class="info">
  <tr>
    <td style="width:12em">Numpad0 / NumpadIns</td><td><kbd>0</kbd> / <kbd>Insert</kbd></td>
  </tr>
  <tr>
    <td>Numpad1 / NumpadEnd</td><td><kbd>1</kbd> / <kbd>End</kbd></td>
  </tr>
  <tr>
    <td>Numpad2 / NumpadDown</td><td><kbd>2</kbd> / <kbd>&darr;</kbd></td>
  </tr>
  <tr>
    <td>Numpad3 / NumpadPgDn</td><td><kbd>3</kbd> / <kbd>PageDown</kbd></td>
  </tr>
  <tr>
    <td>Numpad4 / NumpadLeft</td><td><kbd>4</kbd> / <kbd>&larr;</kbd></td>
  </tr>
  <tr>
    <td>Numpad5 / NumpadClear</td><td><kbd>5</kbd> / typically does nothing</td>
  </tr>
  <tr>
    <td>Numpad6 / NumpadRight</td><td><kbd>6</kbd> / <kbd>&rarr;</kbd></td>
  </tr>
  <tr>
    <td>Numpad7 / NumpadHome</td><td><kbd>7</kbd> / <kbd>Home</kbd></td>
  </tr>
  <tr>
    <td>Numpad8 / NumpadUp</td><td><kbd>8</kbd> / <kbd>&uarr;</kbd></td>
  </tr>
  <tr>
    <td>Numpad9 / NumpadPgUp</td><td><kbd>9</kbd> / <kbd>PageUp</kbd></td>
  </tr>
  <tr>
    <td>NumpadDot / NumpadDel</td><td><kbd>.</kbd> / <kbd>Delete</kbd></td>
  </tr>
  <tr>
    <td>NumLock</td>
    <td><kbd>NumLock</kbd> (number lock key). While the <kbd>Ctrl</kbd> key is held down, the <kbd>NumLock</kbd> key produces the key code of <code>Pause</code>, so use <code>^Pause</code> in hotkeys instead of <code>^NumLock</code>.</td>
  </tr>
  <tr>
    <td>NumpadDiv</td>
    <td><kbd>/</kbd> (division)</td>
  </tr>
  <tr>
    <td>NumpadMult</td>
    <td><kbd>*</kbd> (multiplication)</td>
  </tr>
  <tr>
    <td>NumpadAdd</td>
    <td><kbd>+</kbd> (addition)</td>
  </tr>
  <tr>
    <td>NumpadSub</td>
    <td><kbd>-</kbd> (subtraction)</td>
  </tr>
  <tr>
    <td>NumpadEnter</td>
    <td><kbd>Enter</kbd></td>
  </tr>
</table>
<h3 id="function">Function Keys</h3>
<table class="info">
  <tr>
    <td style="width:12em">F1 - F24</td>
    <td>The 12 or more function keys at the top of most keyboards.</td>
  </tr>
</table>
<h3 id="modifier">Modifier Keys</h3>
<table class="info">
  <tr>
    <td style="width:12em">LWin</td>
    <td>Left <kbd>Win</kbd>. Corresponds to the <code>&lt;#</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>RWin</td>
    <td>
      <p>Right <kbd>Win</kbd>. Corresponds to the <code>&gt;#</code> hotkey prefix.</p>
      <p class="note"><strong>Note</strong>: Unlike <kbd>Control</kbd>/<kbd>Alt</kbd>/<kbd>Shift</kbd>, there is no generic/neutral &quot;Win&quot; key because the OS does not support it. However, hotkeys with the <code>#</code> modifier can be triggered by either <kbd>Win</kbd> key.</p>
    </td>
  </tr>
  <tr>
    <td>Control (or Ctrl)</td>
    <td><kbd>Control</kbd>. As a hotkey (<code>Control::</code>) it fires upon release unless it has the tilde prefix. Corresponds to the <code>^</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>Alt</td>
    <td><kbd>Alt</kbd>. As a hotkey (<code>Alt::</code>) it fires upon release unless it has the tilde prefix. Corresponds to the <code>!</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>Shift</td>
    <td><kbd>Shift</kbd>. As a hotkey (<code>Shift::</code>) it fires upon release unless it has the tilde prefix. Corresponds to the <code>+</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>LControl (or LCtrl)</td>
    <td>Left <kbd>Control</kbd>. Corresponds to the <code>&lt;^</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>RControl (or RCtrl)</td>
    <td>Right <kbd>Control</kbd>. Corresponds to the <code>&gt;^</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>LShift</td>
    <td>Left <kbd>Shift</kbd>. Corresponds to the <code>&lt;+</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>RShift</td>
    <td>Right <kbd>Shift</kbd>. Corresponds to the <code>&gt;+</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>LAlt</td>
    <td>Left <kbd>Alt</kbd>. Corresponds to the <code>&lt;!</code> hotkey prefix.</td>
  </tr>
  <tr>
    <td>RAlt</td>
    <td>
      <p>Right <kbd>Alt</kbd>. Corresponds to the <code>&gt;!</code> hotkey prefix.</p>
      <p class="note"><strong>Note</strong>: If your keyboard layout has AltGr instead of RAlt, you can probably use it as a hotkey prefix via <code>&lt;^&gt;!</code> as described <a href="Hotkeys.htm#AltGr">here</a>. In addition, <code>LControl &amp; RAlt::</code> would make AltGr itself into a hotkey.</p>
    </td>
  </tr>
</table>
<h3 id="multimedia">Multimedia Keys</h3>
<p>The function assigned to each of the keys listed below can be overridden by modifying the Windows registry. This table shows the default function of each key on most versions of Windows.</p>
<table class="info">
  <tr>
    <td style="width:12em">Browser_Back</td>
    <td>Back</td>
  </tr>
  <tr>
    <td>Browser_Forward</td>
    <td>Forward</td>
  </tr>
  <tr>
    <td>Browser_Refresh</td>
    <td>Refresh</td>
  </tr>
  <tr>
    <td>Browser_Stop</td>
    <td>Stop</td>
  </tr>
  <tr>
    <td>Browser_Search</td>
    <td>Search</td>
  </tr>
  <tr>
    <td>Browser_Favorites</td>
    <td>Favorites</td>
  </tr>
  <tr>
    <td>Browser_Home</td>
    <td>Homepage</td>
  </tr>
  <tr>
    <td>Volume_Mute</td>
    <td>Mute the volume</td>
  </tr>
  <tr>
    <td>Volume_Down</td>
    <td>Lower the volume</td>
  </tr>
  <tr>
    <td>Volume_Up</td>
    <td>Increase the volume</td>
  </tr>
  <tr>
    <td>Media_Next</td>
    <td>Next Track</td>
  </tr>
  <tr>
    <td>Media_Prev</td>
    <td>Previous Track</td>
  </tr>
  <tr>
    <td>Media_Stop</td>
    <td>Stop</td>
  </tr>
  <tr>
    <td>Media_Play_Pause</td>
    <td>Play/Pause</td>
  </tr>
  <tr>
    <td>Launch_Mail</td>
    <td>Launch default e-mail program</td>
  </tr>
  <tr>
    <td>Launch_Media</td>
    <td>Launch default media player</td>
  </tr>
  <tr>
    <td>Launch_App1</td>
    <td>Launch My Computer</td>
  </tr>
  <tr>
    <td>Launch_App2</td>
    <td>Launch Calculator</td>
  </tr>
</table>
<h3 id="other">Other Keys</h3>
<table class="info">
  <tr>
    <td style="width:12em">AppsKey</td>
    <td><kbd>Menu</kbd>. This is the key that invokes the right-click context menu.</td>
  </tr>
  <tr>
    <td>PrintScreen</td>
    <td><kbd>PrintScreen</kbd></td>
  </tr>
  <tr>
    <td>CtrlBreak</td>
    <td><kbd>Ctrl</kbd>+<kbd>Pause</kbd> or <kbd>Ctrl</kbd>+<kbd>ScrollLock</kbd></td>
  </tr>
  <tr>
    <td>Pause</td>
    <td><kbd>Pause</kbd> or <kbd>Ctrl</kbd>+<kbd>NumLock</kbd>. While the <kbd>Ctrl</kbd> key is held down, the <kbd>Pause</kbd> key produces the key code of <code>CtrlBreak</code> and <kbd>NumLock</kbd> produces <code>Pause</code>, so use <code>^CtrlBreak</code> in hotkeys instead of <code>^Pause</code>.</td>
  </tr>
  <tr>
    <td>Break</td>
    <td><strong>Deprecated:</strong> Use the synonym <code>Pause</code> instead.</td>
  </tr>
  <tr>
    <td>Help</td>
    <td><kbd>Help</kbd>. This probably doesn't exist on most keyboards. It's usually not the same as <kbd>F1</kbd>.</td>
  </tr>
  <tr>
    <td>Sleep</td>
    <td><kbd>Sleep</kbd>. Note that the sleep key on some keyboards might not work with this.</td>
  </tr>
  <tr id="sc">
    <td>SC<b>nnn</b></td>
    <td>Specify for <b>nnn</b> the scan code of a key. Recognizes unusual keys not mentioned above. See <a href="#SpecialKeys">Special Keys</a> for details.</td>
  </tr>
  <tr id="vk">
    <td >VK<b>nn</b></td>
    <td><p>Specify for <b>nn</b> the hexadecimal virtual key code of a key. This rarely-used method also prevents certain types of <a href="Hotkeys.htm">hotkeys</a> from requiring the <a href="commands/_InstallKeybdHook.htm">keyboard hook</a>. For example, the following hotkey does not use the keyboard hook, but as a side-effect it is triggered by pressing <em>either</em> <kbd>Home</kbd> or NumpadHome:</p>
      <pre>^VK24::MsgBox You pressed Home or NumpadHome while holding down Control.
</pre>
      <p><strong>Known limitation:</strong> VK hotkeys that are forced to use the <a href="commands/_InstallKeybdHook.htm">keyboard hook</a>, such as <code>*VK24</code> or <code>~VK24</code>, will fire for only one of the keys, not both (e.g. NumpadHome but not <kbd>Home</kbd>).
      For more information about the VKnn method, see <a href="#SpecialKeys">Special Keys</a>.</p>
      <p class="warning"><strong>Warning:</strong> Only <a href="commands/Send.htm">Send</a>, <a href="commands/GetKey.htm">GetKeyName()</a>, <a href="commands/GetKey.htm">GetKeyVK()</a>, <a href="commands/GetKey.htm">GetKeySC()</a> and <a href="commands/_MenuMaskKey.htm">#MenuMaskKey</a> support combining VKnn and SCnnn. <span class="ver">[v1.1.27+]:</span> The presence of an invalid suffix prevents VKnn from being recognized. For example, <code>vk1Bsc001::</code> raises an error in v1.1.27+, but <code>sc001</code> was ignored (had no effect) in previous versions.</p>
      </td>
  </tr>
</table>
<h2 id="Joystick">Joystick</h2>
<p><strong>Joy1 through Joy32</strong>: The buttons of the joystick. To help determine the button numbers for your joystick, use this <a href="scripts/index.htm#JoystickTest">test script</a>. Note that <a href="Hotkeys.htm">hotkey prefix symbols</a> such as ^ (control) and + (shift) are not supported (though <a href="commands/GetKeyState.htm">GetKeyState</a> can be used as a substitute). Also note that the pressing of joystick buttons always &quot;passes through&quot; to the active window if that window is designed to detect the pressing of joystick buttons.</p>
<p>Although the following Joystick control names cannot be used as hotkeys, they can be used with <a href="commands/GetKeyState.htm">GetKeyState</a>:<br>
  <strong>JoyX, JoyY, and JoyZ</strong>: The X (horizontal), Y (vertical), and Z (altitude/depth) axes of the joystick.<br>
  <strong>JoyR</strong>: The rudder or 4th axis of the joystick. <br>
  <strong>JoyU and JoyV</strong>: The 5th and 6th axes of the joystick. <br>
  <strong>JoyPOV</strong>: The point-of-view (hat) control.<br>
  <strong>JoyName</strong>: The name of the joystick or its driver. <br>
  <strong>JoyButtons</strong>: The number of buttons supported by the joystick (not always accurate). <br>
  <strong>JoyAxes</strong>: The number of axes supported by the joystick.<br>
  <strong>JoyInfo</strong>: Provides a string consisting of zero or more of the following letters to indicate the joystick's capabilities: <strong>Z</strong> (has Z axis), <strong>R</strong> (has R axis), <strong>U</strong> (has U axis), <strong>V</strong> (has V axis), <strong>P</strong> (has POV control), <strong>D</strong> (the POV control has a limited number of discrete/distinct settings), <strong>C</strong> (the POV control is continuous/fine). Example string: ZRUVPD</p>
<p><strong>Multiple Joysticks</strong>: If the computer has more than one joystick and you want to use one beyond the first, include the joystick number (max 16) in front of the control name. For example, 2joy1 is the second joystick's first button.</p>
<p class="note"><strong>Note</strong>: If you have trouble getting a script to recognize your joystick, one person reported needing to specify a joystick number other than 1 even though  only a single joystick was present. It is unclear how this situation arises or whether it is normal, but experimenting with the joystick number in the <a href="scripts/index.htm#JoystickTest">joystick test script</a> can help determine if this applies to your system.</p>
<p><strong>See Also</strong>:<br>
<a href="misc/RemapJoystick.htm">Joystick remapping:</a> methods of sending keystrokes and mouse clicks with a joystick.<br>
<a href="scripts/index.htm#JoystickMouse">Joystick-To-Mouse script</a>: using a joystick as a mouse.</p>
<h2 id="remote">Hand-held Remote Controls</h2>
<p>Respond to signals from hand-held remote controls via the <a href="scripts/index.htm#WinLIRC">WinLIRC client script</a>.</p>
<h2 id="SpecialKeys">Special Keys</h2>
<p>If your keyboard or mouse has a key not listed above, you might still be able to make it a hotkey by using the following steps:</p>
<ol>
  <li>Ensure that at least one script is running that is using the <a href="commands/_InstallKeybdHook.htm">keyboard hook</a>. You can tell if a script has the keyboard hook by opening its main window and selecting &quot;View-&gt;<a href="commands/KeyHistory.htm">Key history</a>&quot; from the menu bar.</li>
  <li>Double-click that script's tray icon to open its main window.</li>
  <li>Press one of the &quot;mystery keys&quot; on your keyboard.</li>
  <li>Select the menu item &quot;View-&gt;<a href="commands/KeyHistory.htm">Key history</a>&quot;</li>
  <li>Scroll down to the bottom of the page. Somewhere near the bottom are the key-down and key-up events for your key. NOTE: Some keys do not generate events and thus will not be visible here. If this is the case, you cannot directly make that particular key a hotkey because your keyboard driver or hardware handles it at a level too low for AutoHotkey to access. For possible solutions, see further below.</li>
  <li>If your key is detectable, make a note of the 3-digit hexadecimal value in the second column of the list (e.g. <strong>159</strong>).</li>
  <li>To define this key as a hotkey, follow this example:
<pre><strong>SC159::</strong> <em>; Replace 159 with your key's value.</em>
MsgBox, %A_ThisHotkey% was pressed.
return</pre></li>
</ol>
<p><strong>Reverse direction</strong>: To remap some other key to <em>become</em> a &quot;mystery key&quot;, follow this example:</p>
<pre><em>; Replace 159 with the value discovered above. Replace FF (if needed) with the
; key's virtual key, which can be discovered in the first column of the Key History screen.</em>
#c::Send {vkFFsc159} <em>; See <a href="commands/Send.htm#vk">Send {vkXXscYYY}</a> for more details.</em></pre>
<p><strong>Alternate solutions</strong>: If your key or mouse button is not detectable by the <a href="commands/KeyHistory.htm">Key History</a> screen, one of the following might help:</p>
<ol>
  <li>
    <p>Reconfigure the software that came with your mouse or keyboard (sometimes accessible in the Control Panel or Start Menu) to have the &quot;mystery key&quot; send some other keystroke. Such a keystroke can then be defined as a hotkey in a script. For example, if you configure a mystery key to send <kbd>Control</kbd>+<kbd>F1</kbd>, you can then indirectly make that key as a hotkey by using <code>^F1::</code> in a script.</p>
  </li>
  <li>
    <p>Try <a href="https://www.autohotkey.com/board/topic/38015-ahkhid-an-ahk-implementation-of-the-hid-functions/">AHKHID</a>. You can also try searching the <a href="https://www.autohotkey.com/boards/">forum</a> for a keywords like <code>RawInput*</code>, <code>USB HID</code> or <code>AHKHID</code>.</p>
  </li>
  <li>
    <p>The following is a last resort and generally should be attempted only in desperation. This is because the chance of success is low and it may cause unwanted side-effects that are difficult to undo:<br>
      Disable or remove any extra software that came with your keyboard or mouse or change its driver to a more standard one such as the one built into the OS. This assumes there is such a driver for your particular keyboard or mouse and that you can live without the features provided by its custom driver and software.</p>
  </li>
</ol>

<h2 id="IME">CapsLock and IME</h2>
<p>Some configurations of Windows IME (such as Japanese input with English keyboard) use CapsLock to toggle between modes. In such cases, CapsLock is suppressed by the IME and cannot be detected by AutoHotkey. However, the <kbd>Alt</kbd>+<kbd>CapsLock</kbd>, <kbd>Ctrl</kbd>+<kbd>CapsLock</kbd> and <kbd>Shift</kbd>+<kbd>CapsLock</kbd> shortcuts can be disabled with a workaround. Specifically, send a key-up to modify the state of the IME, but prevent any other effects by signalling the keyboard hook to suppress the event. The following function can be used for this purpose:</p>
<pre filename="SendSuppressedKeyUp.ahk">
<em>; Requires AutoHotkey v1.1.26+, and the keyboard hook must be installed.</em>
#InstallKeybdHook
SendSuppressedKeyUp(key) {
    DllCall("keybd_event"
        , "char", GetKeyVK(key)
        , "char", GetKeySC(key)
        , "uint", KEYEVENTF_KEYUP := 0x2
        , "uptr", KEY_BLOCK_THIS := 0xFFC3D450)
}
</pre>
<p>After copying the function into a script or saving it as <em>SendSuppressedKeyUp.ahk</em> in a <a href="Functions.htm#lib">function library</a>, it can be used as follows:</p>
<pre>
<em>; Disable Alt+key shortcuts for the IME.</em>
~LAlt::SendSuppressedKeyUp("LAlt")

<em>; Test hotkey:</em>
!CapsLock::MsgBox % A_ThisHotkey

<em>; Remap CapsLock to LCtrl in a way compatible with IME.</em>
*CapsLock::
    Send {Blind}{LCtrl DownR}
    SendSuppressedKeyUp("LCtrl")
    return
*CapsLock up::
    Send {Blind}{LCtrl Up}
    return
</pre>

</body>
</html>
